package mutsumimod.powers;

import com.megacrit.cardcrawl.actions.common.MakeTempCardInHandAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import mutsumimod.MutsumiMod;
import mutsumimod.cards.copy.Imagination;

public class DollPower extends BasePower {
    public static final String POWER_ID = MutsumiMod.makeID(DollPower.class.getSimpleName());

    public DollPower(AbstractCreature owner, int amount) {
        super(POWER_ID, PowerType.BUFF, false, owner, amount);
    }

    @Override
    public void updateDescription() {
        this.description = DESCRIPTIONS[0] + this.amount + DESCRIPTIONS[1];
    }

    @Override
    public void atStartOfTurn() {
        flash();
        for(int i=0;i<amount;i++) {
            addToBot(new MakeTempCardInHandAction(new Imagination()));
        }
    }

    @Override
    public void atEndOfTurn(boolean isPlayer) {
        if (isPlayer){
            flash();
            for(AbstractCard c:AbstractDungeon.player.hand.group){
                if(c instanceof Imagination){
                    c.retain = true;
                    c.superFlash();
                    ((Imagination) c).upgradeRarity();
                }
            }
        }
    }

}
